<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>定制洗衣系统主页</title>
</head>
<link rel="stylesheet" type="text/css"
	href="bootstrap/css/bootstrap.css" />
<script type="text/javascript" src="js/jquery-3.2.1.min.js"></script>
<script src="js/jquery.min.js"></script>
<script type="text/javascript" src="bootstrap/js/bootstrap.js"></script>
<script type="text/javascript" src="bootstrap/js/docs.min.js"></script>
<style>
#header {
	width: 100%;
	background: #1AA094;
}

#titel {
	text-align: center;
	line-height: 90px;
	font-size: 40px;
	letter-spacing: 10px;
	color: white;
}

#titel p:hover {
	color: red;
}

#userManage {
	height: 50px;
	line-height: 50px;
}

#now_uesr {
	margin-left: 70%;
	cursor: pointer;
	text-decoration: none;
	color: white;
}

#now_user_name {
	cursor: pointer;
	text-decoration: none;
	color: white;
}

#changge_user {
	margin-left: 25px;
	cursor: pointer;
	text-decoration: none;
	color: white;
}

#loyout {
	margin-left: 25px;
	cursor: pointer;
	text-decoration: none;
	color: white;
}

#left {
	background: #1AA094;
	text-align: center;
}

#left_nav div {
	padding: 10px;
	margin: 10px;
	font-size: 20px;
	cursor: pointer;
}

#left_nav div:hover {
	color: red;
	background: beige;
}

#content {
	
}

#nav {
	font-size: 20px;
	color:red;
}

#now_location {
	color: black;
	background: #B2DBA1;
	height: 50px;
	line-height: 50px;
	padding-left: 15px;
}

#hy_div {
	text-align: center;
	color: blue;
	font-size: 50px;
	line-height: 500px;
}

#xiadan_div_detail {
	padding-top: 20%;
	border: 1px solid red;
}
#change_div_1, #change_div_2, #change_div_3, #change_div_4 {
	padding: 10px;
}
#btn_change_user_div_1,#btn_change_user_div_2,#btn_change_user_div_3,#btn_change_user_div_4,#btn_change_user_div_5{
	padding: 10px;
}
#msg2 {
	height: 20px;
	color: red;
}
.modal-content {
	margin-top: 250px;
}
#change_title{
	color:red;
}
#user_manage_div_detail{
	padding:30px 50px;
}
#user_manage_div_table{
	margin-top:15px;
}
#user_manage_div_table {
	text-align: center;
}
</style>

<body>
	<div id="header" class="row col-md-12">
		<div id="titel" class="col-md-3">
			<p>定制洗衣系统</p>
		</div>
		<div id="userManage" class="col-md-9">
			<a id="now_uesr">当前用户:</a> <a id="now_user_name">${sessionScope.user.userName}
			</a>  <a id="loyout">退出系统</a>
		</div>
	</div>
	<div id="" class="row">

		<div id="left" class="col-md-2">
			<div id="nav" class="col-md-10">
				<p>导航菜单</p>
			</div>
			<div id="left_nav" class="col-md-10">
				<div id="welcome">
					<p>欢迎页</p>
				</div>
				<div id="xiadan" onclick="wyxd()">
					<p>我要下单</p>
				</div>
				<div id="dingdan" onclick="wdddManage()">
					<p>我的订单</p>
				</div>
				<div id="dingdan_manage" onclick="adminDdglManage()">
					<p>订单管理</p>
				</div>
				<div id="user_manage" onclick="userManage()">
					<p>用户管理</p>
				</div>
				<div id="huogui_manage" onclick="hgManage()">
					<p>货柜管理</p>
				</div>
				<div id="cunfang_manage" onclick="cfddManage()">
					<p>存放地点管理</p>
				</div>
				<div id="yiwu_manage"  onclick="ywzlManage()">
					<p>衣物种类管理</p>
				</div>
				<div id="price_manage" onclick="priceManage()">
					<p>价格管理</p>
				</div>
				<div id="xiyifangfa_manage" onclick="xyffManage()">
					<p>洗衣方法管理</p>
				</div>
			</div>
		</div>
		<div id="content" class="row col-md-10">
			<div id="now_location">
				<p id="now_location_p">当前位置：欢迎页</p>
			</div>
			<div id="hy_div">
				<p>欢迎使用定制洗衣系统</p>
			</div>
			<%@ include file="../jsp/user_manage.jsp" %>
			<%@ include file="../jsp/xyff_manage.jsp" %>
			<%@ include file="../jsp/cfdd_manage.jsp" %>
			<%@ include file="../jsp/ywzl_manage.jsp" %>
			<%@ include file="../jsp/price_manage.jsp" %>
			<%@ include file="../jsp/hg_manage.jsp" %>
			<%@ include file="../jsp/admin_ddgl_manage.jsp" %>
<%-- 			<div id="xiadan_div" class="row" style="display: none">
				<div id="xiadan_div_detail" class="col-md-offset-3 col-md-6">
					<form>
						用户名:<input type="text" value="${sessionScope.user.userName}"
							disabled="disabled" />
					</form>
				</div>
			</div> --%>
			
		</div>
	</div>
	

</body>
<script>
//订单管理
function adminDdglManage(){
	$("#admin_ddgl_manage_div").show();
	$("#hy_div").hide();
	$("#wyxd_div").hide();
	$("#wddd_manage_div").hide();
	$("#xiadan_div").hide();
	$("#user_manage_div").hide();
	$("#xiff_manage_div").hide();
	$("#cfdd_manage_div").hide();
	$("#admin_ddgl_manage_div").hide();
	$("#hg_manage_div").hide();
	adminQueryDd();
}
//我的订单
function wdddManage(){
	$("#wyxd_div").hide();
	$("#wddd_manage_div").show();
	$("#hy_div").hide();
	$("#admin_ddgl_manage_div").hide();
	queryWddd();
}
//我要下单
function wyxd(){
	$("#wyxd_div").show();
	$("#wddd_manage_div").hide();
	$("#hy_div").hide();
	$("#admin_ddgl_manage_div").hide();
	wyxdQuery();
}
//货柜管理
function hgManage(){
	$("#hg_manage_div").show();
	$("#price_manage_div").hide();
	$("#yfzl_manage_div").hide();
	$("#cfdd_manage_div").hide();
	$("#xiff_manage_div").hide();
	$("#xiadan_div").hide();
	$("#user_manage_div").hide();
	$("#hy_div").hide();
	$("#admin_ddgl_manage_div").hide();
	hgManageQuery();
}
//价格管
function priceManage(){
	$("#price_manage_div").show();
	$("#hg_manage_div").hide();
	$("#yfzl_manage_div").hide();
	$("#cfdd_manage_div").hide();
	$("#xiff_manage_div").hide();
	$("#xiadan_div").hide();
	$("#user_manage_div").hide();
	$("#hy_div").hide();
	$("#admin_ddgl_manage_div").hide();
	priceManageQuery();
}
//衣物种类
function ywzlManage(){
	$("#yfzl_manage_div").show();
	$("#hg_manage_div").hide();
	$("#price_manage_div").hide();
	$("#cfdd_manage_div").hide();
	$("#xiff_manage_div").hide();
	$("#xiadan_div").hide();
	$("#user_manage_div").hide();
	$("#hy_div").hide();
	$("#admin_ddgl_manage_div").hide();
	yfzlManageQuery();
}
//存放地点
function cfddManage(){
	$("#cfdd_manage_div").show();
	$("#hg_manage_div").hide();
	$("#price_manage_div").hide();
	$("#yfzl_manage_div").hide();
	$("#xiff_manage_div").hide();
	$("#xiadan_div").hide();
	$("#user_manage_div").hide();
	$("#hy_div").hide();
	$("#admin_ddgl_manage_div").hide();
	cfddManageQuery();
}
//用户管理
	function userManage() {
		$("#user_manage_div").show();
		$("#hg_manage_div").hide();
		$("#price_manage_div").hide();
		$("#yfzl_manage_div").hide();
		$("#cfdd_manage_div").hide();
		$("#hy_div").hide();
		$("#xiff_manage_div").hide();
		$("#admin_ddgl_manage_div").hide();
		$.ajax({
			url : "user_manage", //请求的url地址
			contentType : "application/json; charset=utf-8",
			dataType : "json", //返回格式为json
			type : "POST",
			beforeSend : function() {
			},
			success : function(data) {
				console.log(data.users.length);
				if(data.isSuccess && data.users.length > 0){
					var str = '';
					for(var i = 0;i < data.users.length;i++){
						str += "<tr><td>" + (i+1) + "</td><td>" + data.users[i].userName + "</td><td>" + data.users[i].tel + "</td><td>" 
						+ data.users[i].address + "</td><td>";
						if(data.users[i].userType == 1){
							str += "普通用户"
						}else{
							str += "管理员"
						}
						str += "</td>"+"<td><button type='button' class='btn btn-warning' data-toggle='modal' data-target='#btn_change_user' onclick='btnChangeUser(this)'>修改</button>&nbsp&nbsp/&nbsp&nbsp<button type='button' class='btn btn-danger' onclick='btnDeleteUser(this)'>删除</button></td><td style='display: none'>"+ data.users[i].id +"</td></tr>"
					}
					$("#user_manage_div_table_tbody").html(str);
				}else{
					$("#user_manage_div_table_tbody").html("没有数据");
				}
			},
			complete : function() {
				//请求完成的处理
				//alert("请求完成");
			},
			error : function(req) {
				alert("  error  请联系开发人员 ！");
			}
		})
	};
	//洗衣方法
	function xyffManage(){
		$("#xiff_manage_div").show();
		$("#hg_manage_div").hide();
		$("#price_manage_div").hide();
		$("#yfzl_manage_div").hide();
		$("#cfdd_manage_div").hide();
		$("#xiadan_div").hide();
		$("#user_manage_div").hide();
		$("#hy_div").hide();
		$("#admin_ddgl_manage_div").hide();
		xyffManageQuery();
	}
	$("#xiadan").click(function() {
		$("#xiadan_div").show();
		$("#hy_div").hide();
		$("#admin_ddgl_manage_div").hide();
	});
	$("#welcome").click(function() {
		$("#hy_div").show();
		$("#wyxd_div").hide();
		$("#wddd_manage_div").hide();
		$("#xiadan_div").hide();
		$("#user_manage_div").hide();
		$("#xiff_manage_div").hide();
		$("#cfdd_manage_div").hide();
		$("#admin_ddgl_manage_div").hide();
	});
	$("#left").css("height", $(window).height() - 120);
	$("#left_nav div p").click(function() {
		$("#now_location_p").html("");
		$("#now_location_p").html("当前位置:" + $(this).html());
	});
	$(document).ready(function() {
		var user_type = ${sessionScope.user.userType};
		if (user_type == 1) {
			$("#dingdan_manage").hide();
			$("#user_manage").hide();
			$("#huogui_manage").hide();
			$("#cunfang_manage").hide();
			$("#yiwu_manage").hide();
			$("#price_manage").hide();
			$("#xiyifangfa_manage").hide();
		} else {
			$("#xiadan").hide();
			$("#dingdan").hide();
		}
		$("#xiadan_div").hide();
	});
	$("#loyout").click(function() {
		$.ajax({
			url : "loyout", //请求的url地址
			contentType : "application/json; charset=utf-8",
			dataType : "json", //返回格式为json
			type : "POST",
			beforeSend : function() {
			},
			success : function(data) {
				window.location = "index";
			},
			complete : function() {
				//请求完成的处理
				//alert("请求完成");
			},
			error : function(req) {
				alert("  error  请联系开发人员 ！");
			}
		});
	});
	function doNext(s) {
		$("#msg2_span2").html('将在' + s + '秒后自动跳转到登陆页');
		if(s > 0){
			s--;
		 	setTimeout("doNext(" + s + ")", 1000);
		}else{
			window.location = "index";
		}
	}
</script>

</html>